import { Column, Entity } from "typeorm";
import { BaseEntity } from "../../base/entity/base";
import { CommonAuditStatus } from "../../../interface";

/**
 * 商户上架产品到云仓之后，修改产品信息，
 * 会导致其他引用云仓产品的商户下架产品，需要重新进行审核之后继续上架
 */
@Entity('storage_info', { comment: '云仓产品信息' })
export class StorageInfoEntity extends BaseEntity {

    @Column({
        comment: '云仓产品ID',
        unique: true,
        nullable: false
    })
    productId: number

    @Column({
        comment: '共享此产品的商家',
        nullable: true
    })
    sharedByTenantId: number

    @Column({
        comment: '过期时间',
        nullable: true
    })
    expireDate: Date

    @Column({
        comment: '状态',
        type: 'enum',
        enum: CommonAuditStatus,
        default: CommonAuditStatus.PENDING
    })
    status: CommonAuditStatus

    @Column({
        comment: '驳回原因',
        nullable: true
    })
    rejectReason?: string

}